package qgs.zisu.javaconcurrency.javaconcurrency.chapter10_LockTrick;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Locale;

/**
 * @Author: 蔡翔
 * @Date: 2020/5/17 8:03
 * @Version 1.0
 */
public class test {
    private static final Object LOCK = new Object();
    public static void main(String[] args) {
        new Thread(()->{
            synchronized (LOCK){
                try {
                    LOCK.wait();
                    System.out.println("t1 wait");

                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t1").start();
        new Thread(()->{
            synchronized (LOCK){
                try {
                    LOCK.wait();
                    System.out.println("t2 nofigy");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t2").start();

        new Thread(()->{
            synchronized (LOCK){
                try {
                    LOCK.wait();
                    System.out.println("t3 wait");

                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t3").start();
        new Thread(()->{
            synchronized (LOCK){

                LOCK.notify();
                System.out.println("t4 nofigy");

            }
        },"t4").start();


    }
}
